// 引入express模块
const express = require('express')

// 生成express实列
const server = express()


//req.body要配置中间件使用
server.use(express.json())
server.use(express.urlencoded({extended: true}))
// 处理路由
server.get('/', (req, res) => {
  res.send('hello express')
})

// 实现http://localhost:8080/login  ->登录
server.get("/login", (req, res) => {
  res.send('登录')
  console.log(req.params, req.body, req.query, req.path)
})

//监听端口
server.listen(8080)